package cn.wolfcode.wolf2w.controller;
import cn.wolfcode.wolf2w.service.*;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.awt.print.Pageable;

@RestController
@RequestMapping("/destinations")
public class DestinationController {
    @Autowired
    private IRegionService regionService;
    @Autowired
    private IDestinationService destinationService;
    @Autowired
    private IStrategyCatalogService strategyCatalogService;
    @Autowired
    private IStrategyService strategyService;
    @Autowired
    private ITravelService travelService;

    @GetMapping("/hotRegion")
    public Object hotRegion() {
        return JsonResult.success(regionService.queryHotRegion());
    }

    //前端目的地热门目的地
    @GetMapping("/search")
    public Object search(String regionId) {
        return JsonResult.success(destinationService.queryDestByRegionIdForApi(regionId));
    }

    @GetMapping("/toasts")
    public Object toasts(String destId) {
        return JsonResult.success(destinationService.queryToasts(destId));
    }

    @GetMapping("/catalogs")
    public Object catalogs(String destId) {

        return JsonResult.success(strategyCatalogService.queryCatalogsByDestId(destId));
    }

    @GetMapping("/strategies/viewnumTop3")
    public Object viewnumTop3(String destId) {

        return JsonResult.success(strategyService.queryViewnumTop3ByDestId(destId));
    }

    @GetMapping("/travels/viewnumTop3")
    public Object travelsViewnumTop3(String destId) {

        return JsonResult.success(travelService.querytravelsViewnumTop3ByDestId(destId));
    }

    @GetMapping("/list")
    public Object list() {
        return JsonResult.success(destinationService.list());
    }
}